//
//  AFNBlock.m
//  MeiShi
//
//  Created by apple on 15/7/25.
//  Copyright (c) 2015年 龙哥. All rights reserved.
//

#import "AFNBlock.h"

@implementation AFNBlock
+(void)getDataWithString:(NSString *)string block:(AFNData)block
{
    AFNetworkReachabilityManager *netWorkManager = [AFNetworkReachabilityManager sharedManager];
    NSString *url_string = [NSString stringWithFormat:@"%@",string];
    AFHTTPRequestOperationManager* manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html",nil];
    [manager GET:url_string parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        [netWorkManager stopMonitoring];
        //        NSLog(@"使用AFN进行get请求 ===  %@",responseObject);
        block(responseObject);
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        NSLog(@"失败 === %@",error);

    }];
    
}

@end
